#!/bin/bash
echo -e "\e[H\e[J" 
echo -e "\e[37;1m    ___                                                __\e[0m"
echo -e "\e[37;1m   /   |  _________ _____  ____  ____  ____  ___  ____/ /\e[0m"
echo -e "\e[37;1m  / /| | / ___/ __ \`/ __ \/ __ \/ __ \/ __ \/ _ \/ __  / \e[0m"
echo -e "\e[37;1m / ___ |/ /  / /_/ / /_/ / / / / /_/ / / / /  __/ /_/ /  \e[0m"
echo -e "\e[37;1m/_/  |_/_/   \__, /\____/_/ /_/\____/_/ /_/\___/\__,_/   \e[0m"
echo -e "\e[37;1m            /____/                                       \e[0m"
echo "_________________________________________________________"
echo -e "\e[1m>>> Reset build to mrproper...\e[0m"
make mrproper
echo -e "\e[1m>>> Running prebuild configuration...\e[0m"
./configure $@
if [ $? -ne 0 ]
then
    echo -e "\e[31;1m>>> Configuration ERROR...\e[0m"
    exit 1;
fi
echo -e "\e[1m>>> Building...\e[0m"
make all $@
if [ $? -ne 0 ]
then
    echo -e "\e[31;1m>>> Build ERROR...\e[0m"
    exit 1;
fi
echo -e "\e[1m>>> Installing...\e[0m"
if [ "$EUID" -ne 0 ]
    then sudo make install
    else make install
fi
echo -e "\e[1m>>>  Complete\e[0m"
